<?php

namespace App\Http\Resources\Mp;

use Illuminate\Http\Resources\Json\Resource;

/**
 * Class ChildrenResource
 * @package App\Http\Resources\Mp
 */
class ChildrenResource extends Resource
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'avatar' => $this->avatar,
            'avatar_url' => $this->avatar_url,
            'sex' => $this->sex,
            'relation' => $this->relation,
            'user_id' => $this->user_id,
            'orders_count' => $this->orders_count,
            'morning_rule' => $this->morning_rule,
            'lunch_rule' => $this->lunch_rule,
            'dinner_rule' => $this->dinner_rule,
            'created_at' => $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null
        ];
    }
}
